package dev.projectnightfall.graphics.states;

import dev.projectnightfall.graphics.RenderEngine;
import org.lwjgl.input.Keyboard;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;

/**
 *
 * @author Oscuro1987
 */
public class PauseState extends AGameState {

    public PauseState(int stateID) {
        super(stateID);
    }

    @Override
    public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
    }

    @Override
    public void render(GameContainer gc, StateBasedGame game, Graphics g) throws SlickException {
        g.drawString("Game is in pause...", 100, 100);
        g.drawString("Press R to resume", 100, 120);
        g.drawString("Press Q to quit to the main menu", 100, 140);
    }

    @Override
    public void update(GameContainer gc, StateBasedGame game, int delta) throws SlickException {
        Input in = gc.getInput();
        in.disableKeyRepeat();

        if (in.isKeyDown(Keyboard.KEY_Q)) {
            // Quit to main menu
            game.enterState(RenderEngine.MAINMENUSTATE);
        }

        if (in.isKeyDown(Keyboard.KEY_R)) {
            // Resume game
            game.enterState(RenderEngine.GAMEPLAYSTATE);
        }
    }
}
